5f9b023a76fc5a105d20860611ec589c8d85ad83,odfdom/src/main/java/org/odftoolkit/odfdom/pkg/OdfPackage.java,OdfPackage,createZipEntry,#String#number[]#ZipOutputStream#number#CRC32#,928

Before Change



	private void createZipEntry(String path, byte[] data, ZipOutputStream zos, long modTime, CRC32 crc)
			throws IOException {
		ZipEntry ze = mZipEntries.get(path);
		if (ze == null) {
			ze = new ZipEntry(path);
		}
		ze.setTime(modTime);
		if (fileNeedsCompression(path)) {
			ze.setMethod(ZipEntry.DEFLATED);
		} else {
			ze.setMethod(ZipEntry.STORED);
		}
		crc.reset();
		if (data != null) {
			ze.setSize(data.length);
			crc.update(data);
			ze.setCrc(crc.getValue());
		} else {
			ze.setSize(0);
			ze.setCrc(0);
		}
		ze.setCompressedSize(-1);
		zos.putNextEntry(ze);
		if (data != null) {
			zos.write(data, 0, data.length);

After Change


	private void createZipEntry(String path, byte[] data, ZipOutputStream zos, long modTime, CRC32 crc) throws IOException {
		ZipEntry ze = null;
		// try {
		ze = mZipEntries.get(path);
		if (ze == null) {
			ze = new ZipEntry(path);
		}
		ze.setTime(modTime);
		if (fileNeedsCompression(path)) {
			ze.setMethod(ZipEntry.DEFLATED);
		} else {
			ze.setMethod(ZipEntry.STORED);
		}
		crc.reset();
		if (data != null) {
			OdfFileEntry fileEntry = mManifestEntries.get(path);
			// encrypt file
			if (data.length > 0 && fileNeedsEncryption(path)) {
				data = encryptData(data, fileEntry);
				// encrypted file entries shall be flagged as 'STORED'.
				ze.setMethod(ZipEntry.STORED);
				// the size of the encrypted file should replace the real
				// size value.
				ze.setCompressedSize(data.length);
			} else {
				if (fileEntry != null) {
					fileEntry.setSize(null);
					FileEntryElement fileEntryEle = fileEntry.getOdfElement();
					EncryptionDataElement encryptionDataElement = OdfElement.findFirstChildNode(EncryptionDataElement.class, fileEntryEle);
					while (encryptionDataElement != null) {
						fileEntryEle.removeChild(encryptionDataElement);
						encryptionDataElement = OdfElement.findFirstChildNode(EncryptionDataElement.class, fileEntryEle);
					}
				}
				ze.setCompressedSize(-1);
			}
			ze.setSize(data.length);
			crc.update(data);